package Config;

import CD.impl.SgtPeppers;
import CD.services.CompactDisc;
import Media.impl.CDPlayer;
import Media.services.MediaPlayer;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.context.WebApplicationContext;

@Configuration
@PropertySource("classpath:app.properties")
public class JavaCDPlayerConfig {

    @Autowired
    private Environment environment;

    @Value("123")
    private String title;

    @Bean
//    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
//    @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.INTERFACES)
    public MediaPlayer getMediaPlayer(CompactDisc compactDisc) {
        System.out.println(environment.getProperty("disc.title"));
        return new CDPlayer(compactDisc);
    }

//    @Bean
//    public CompactDisc getCompactDisc(){
//        return new SgtPeppers();
//    }
}
